package com.lw.io.charstream;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class FileReaderBufTest {

    public static void main(String[] args) throws IOException {
        //Reader reader = new FileReader("test.txt");
        InputStreamReader reader = new InputStreamReader(new FileInputStream("test.txt"), "GBK");
        char[] chars = new char[1024]; //申请一个字节数组  1K。
        int len = 0;
        while((len=reader.read(chars))!=-1){
            System.out.println(len);
            System.out.print(new String(chars,0,len));
        }
        reader.close();
    }

    }

